Jell: Parser Generator Reference
java sbktech.tools.jell.driver
[-tokenPackage packageName]
[-tokenFile fileName]
[-tokenClass className]
[-parserFile fileName]
[-grammar]
jellSpecificationFile
-tokenPackage: Package into which the token interface must be placed
(default none)
-tokenFile : File into which the token interface must be placed
(default token.java)
-tokenClass : Class name for token interface
(default token)
-parserFile : File into which the parser is generated
(default parser.java)
-grammar : Just print out the grammar alone, devoid of all actions
program ::= (ACTION) ? (((term_defn | nt_defn) | rule_stmt)) + (ACTION) ? term_defn ::= TERMINAL (term_ref) * END term_ref ::= ID (COLON ID) ? nt_defn ::= NONTERMINAL (nt_ref) * END nt_ref ::= ID (SQ_OPEN arglist SQ_CLOSE) ? (COLON ID) ? arglist ::= (ID (COMMA ID) *) ? rule_stmt ::= var_ref (ACTION) ? DERIVES or_expression SEMI or_expression ::= cat_expression (OR cat_expression) * cat_expression ::= unary_expression (unary_expression) * unary_expression ::= singleton (((PLUS | QMARK) | STAR)) ? singleton ::= (USER_SELECT) ? primary (ACTION) ? primary ::= ((var_ref | PAREN_OPEN or_expression PAREN_CLOSE) | EPSILON) var_ref ::= ID (SQ_OPEN varglist SQ_CLOSE) ? (COLON ID) ? varglist ::= (ID (COMMA ID) *) ?This definition was generated from the jell specification file for jell's parser.
Jell uses a straightforward algorithms to compute FIRST/FOLLOW sets for the grammar, and constructs a recursive descent parser from it. Error repair and recovery are implemented using these sets to determine how to skip and insert tokens.
The input is specified in an EBNF format which is converted into a tree, one tree for each rule. In the current implementation, there is only one rule permitted per nonterminal.
Once all the trees have been created, the FIRST set for each node is computed by traversing all the trees until no more elements are added to any FIRST set. These rules are recursively used to compute the follow set.
Error recovery is implemented by passing down the first set of the next node that can be reduced whenever entering a subrule. On getting an error, the list of tokens that are used as a stop set consist of the union of all these first sets in the current call stack, and the expected set of the token where the syntax error occurred. **expand**.
KB Sriram
Comments, bug reports: kbs@sbktech.org
Revised: Sat May 25 10:46:40 1996
URL: http://www.sbktech.org/jell-ref.html